<?php
getHeader();

?>
<div id="content">
<div class="tabs headTabs"><span>密码修改</span></div>
<div class="dataList"><?php 
if (isset($_POST['curPwd']))
{
	$person = userProf::getUserByUid((int)$_SESSION['uid']);
	if ($_POST['newPwd'] == $_POST['renewPwd'])
	{
		switch ($person->pwdEdit($_POST['curPwd'],$_POST['newPwd']))
		{
			case 0:
				echo "<span>修改成功.</span>";
				break;
			case 1:
				echo "<span>当前密码输入错误, 修改失败.</span>";
				break;
			case 2:
				echo "<span>新密码不符合要求, 修改失败.</span>";
				break;
			case 3:
				echo "<span>修改失败, 请联络管理员修复.</span>";
				break;
			default:
				echo "";
		}
	}
	else
	{
		echo "<span>两次密码输入不相同, 请重新输入.</span>";
	}
}
else if (isset($_SESSION['authPassed']))
{
	?>
<form action="?p=editPwd" method="post"><span>当前密码: </span><br />
<input type="password" name="curPwd" /><br />
<span>新密码: </span><br />
<input type="password" name="newPwd" /><br />
<span>确认新密码: </span><br />
<input type="password" name="renewPwd" /><br />
<input type="submit" value="提交修改" class="button" /></form>
	<?php
}
else
{
	echo "<span>你当前为游客, 不能修改密码.</span>";
}
?></div>
</div>
<?php
getPanel();
getFooter();
?>